import { getLogin } from "../../request/index";
import { Form, Input, Button } from "antd-mobile";
import useHooks from "../../Share/useFd";
function Login() {
  const onFinish = (values: any) => {
    // console.log(345);
    getLogin(values).then((res) => {
      localStorage.setItem("token", res.data.data.token);
      console.log(res);
    });
  };
  // useHooks()
  return (
    <div>
      <Form
        onFinish={onFinish}
        layout="horizontal"
        footer={
          <Button block type="submit" color="primary" size="large">
            登录
          </Button>
        }
      >
        <Form.Item
          name="username"
          label="账号"
          rules={[{ required: true, message: "账号不能为空" }]}
        >
          <Input placeholder="请输入账号" />
        </Form.Item>

        <Form.Item
          name="password"
          label="密码"
          rules={[{ required: true, message: "密码不能为空" }]}
        >
          <Input placeholder="请输入密码" />
        </Form.Item>
      </Form>
    </div>
  );
}

export default Login;
